<template>
    <div>
      商品分类
      <el-table
        :data="list"
        row-key="id"
        border
       >
        <el-table-column
          prop="name"
          label="菜单名称"
         >
        </el-table-column>
        <el-table-column
          prop="name"
          label="分类名称"
         >
        </el-table-column>
        <el-table-column
          prop="address"
          label="icon">
          <template v-slot="scope">
            <!-- {{ scope.row.category }} -->
            <img :src="scope.row.icon" alt="">
          </template>
        </el-table-column>
        <el-table-column
          prop="address"
          label="显示状态">
          <template v-slot="scope" >
            <div> {{ scope.row.showStatus ? "显示":"不显示" }}</div>
             
          </template>
        </el-table-column>
      </el-table>
    </div>
</template>

<script>
import {
  getAllCategory
} from "@/api/goodsManage/category"
export default {
    data() {
        return {
          list:[]
        };
    },
    computed: {

    },
    created() {
      getAllCategory()
      .then(res =>{
       
       var arr =  res.data.items.map(ele =>{
          return {
            ...ele.category,
            children:ele.children
          }
        })
        console.log(arr);
        this.list = arr;
      })
    },
    mounted() {

    },
    methods: {

    },
};
</script>

<style scoped lang="scss">

</style>
